package com.shop.shop.model;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Data
public class Chart {
    private Long cid;
    private Long uid;
    private List<GoodCount> goodList;
    private BigDecimal sumPrice;

    public Chart() {

    }

    public Chart(Long cid, Long uid, List<GoodCount> goodList, BigDecimal sumPrice) {
        this.cid = cid;
        this.uid = uid;
        this.goodList = goodList;
        this.sumPrice = sumPrice;
    }

    public Chart(ChartMysql chartMysql) {
        this.cid = chartMysql.getCid();
        this.uid = chartMysql.getUid();
        this.sumPrice = chartMysql.getSumPrice();
        this.goodList = JSONArray.parseArray(chartMysql.getGoodList(),GoodCount.class);
    }

}
